#include "dialog_publish.h"
#include "ui_dialog_publish.h"
#include "../utility/SceneExport.h"
#include <QFileDialog>
#include <QStandardPaths>

DialogPublish::DialogPublish(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::DialogPublish)
{
    ui->setupUi(this);
}

DialogPublish::~DialogPublish()
{
    delete ui;
}

void DialogPublish::on_pushButtonPublish_clicked()
{
    QString fileName = QFileDialog::getSaveFileName(this,
        "导出",
        QStandardPaths::writableLocation(QStandardPaths::HomeLocation),
        "Avatar资源包 (*.zip)");
    if (fileName.isEmpty()) return;
    QFileInfo fileInfo(fileName);
    if (fileInfo.suffix().toUpper() != "ZIP") fileName += ".zip";
    SceneExport exporter;
    exporter.Export(fileName);
}
